<template>
  <div>
    <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="保单信息" name="first">
        <Tabs-one ref="tabOne" :csm-type-map="csmTypeMap" :insure-status-map="insureStatusMap" />
      </el-tab-pane>
      <el-tab-pane label="变更信息" name="second">
        <Tabs-two :csm-type-map="csmTypeMap" :insure-status-map="insureStatusMap" @synchronize="fresh" />
      </el-tab-pane>
    </el-tabs>

  </div>
</template>
<script>
  import { mergeAsyncFunc } from '@/utils/mergeAsyncFunc'
  import { queryMap } from '@/api'

  export default {
    components: {
      TabsOne: require('./components/TabsOne.vue').default,
      TabsTwo: require('./components/TabsTwo.vue').default
    },
    data() {
      return {
        activeName: 'first',
        csmTypeMap: [],
        insureStatusMap: []
      }
    },
    created() {
      this.queryOptionsMap()
    },
    methods: {
      // 查询枚举
      async queryOptionsMap() {
        const [res1, res2] = await Promise.all([mergeAsyncFunc(queryMap, { enumName: 'CustomerType' }), mergeAsyncFunc(queryMap, { enumName: 'InsureStatus' })])
        this.csmTypeMap = res1.data // 客户类型
        this.insureStatusMap = res2.data // 保单状态
      },
      fresh() {
        this.$refs.tabOne.search()
      }
    }
  }
</script>

